package com.leadnews.controller;

import com.leadnews.pojo.User;
import com.leadnews.service.MessageDetailService;
import com.leadnews.service.MessageService;
import com.leadnews.service.UserService;
import com.leadnews.vo.ResponseResult;
import com.leadnews.vo.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping
@CrossOrigin(origins = "*",maxAge = 3600)
public class MessageController {
    @Autowired
    MessageService messageService;
    @PostMapping("/findMessage")
    public ResponseResult findMessage(@RequestBody Map<String,String> userVo){
        return messageService.findMessage(userVo);
    }
    @Autowired
    MessageDetailService messageDetailService;
    @PostMapping("/findMessageDetail")
    public ResponseResult findMessageDetail(@RequestBody User user){
        return messageDetailService.findMessageDetail(user);
    }
    @Autowired
    UserService userService;
    @PostMapping("/searchchart")
    public ResponseResult searchchart(@RequestBody Map map){
        String username =(String) map.get("username");
        return userService.searchchart(username);
    }
}
